from datetime import date
from datetime import datetime
from datetime import time
from datetime import timedelta
print(date.max)
print(date.min)

# import datetime as dt
# print(dt.date.max)
# print(dt.date.min)

now = date.today()
print(now.year,now.month,now.day)

now2 = datetime.now()
print(now2.year,now2.month,now2.day,now2.hour,now2.minute,now2.second)
print(now2.date())
print(now2.time())

#构造时间对象
a = date(2020,3,19)
b = date(2020,3,22)
c = datetime(2020,3,19,15,19,0)
d = time(15,19,0)
print(a,b,c,d)

#时间的运算
print(a>b)
print(a==b)
print(a<b)
print(a.__gt__(b))
print(a.__eq__(b))
print(a.__lt__(b))

print(a-b)   #计算时间间隔，timedelta
gap = a-b
print(gap.days)
print(gap.seconds)

threeDayBefor = a-timedelta(days=3)
print(threeDayBefor)
threeDayAfter = a+timedelta(days=3)
print(threeDayAfter)

print(threeDayAfter.ctime())#英文时间字符串
print(threeDayAfter.timetuple())#时间元组
print(threeDayAfter.strftime("%Y#%m#%d"))



